package com.future.config.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 通用返回结果
 *
 * @author shiyong
 * 2019-11-11 16:50
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CommonResult<T> {

    public static final String OK = "0";// 成功
    public static final String FAIL = "1";// 失败

    /**
     * 结果代码（0：成功，1：失败）
     */
    private String resultCode = "";

    /**
     * 结果信息
     */
    private String resultMsg = "";

    /**
     * 结果数据
     */
    private T resultData;

    public CommonResult(String resultCode, String resultMsg) {
        this.resultCode = resultCode;
        this.resultMsg = resultMsg;
    }

    public CommonResult(T resultData) {
        this.resultCode = CommonResult.OK;
        this.resultMsg = "成功！";
        this.resultData = resultData;
    }
}
